package com.zkdcloud.util;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author zk123
 * @version 2018/5/22
 */
public class ResponseAndroidUtil {

    public static void responseError(String errorMsg, HttpServletResponse response){
        response.setStatus(401);
        try {
            response.setCharacterEncoding("UTF-8");
            response.getWriter().append("{\n" + "\"error\":\"401\",\n" + "\"message\":\""+errorMsg+"\"\n" + "}").close();
            response.flushBuffer();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
